//
//  MenuPlayLayer.cpp
//  Jump
//
//  Created by Zach Wang on 14-5-21.
//
//
#include "TransitionCustom.h"
#include "MenuPlayLayer.h"
#include "HelloWorldScene.h"

USING_NS_CC;

bool MenuPlayLayer::init(){
    if ( !Layer::init() )
    {
        return false;
    }
    
    Size visibleSize = Director::getInstance()->getVisibleSize();
    Point origin = Director::getInstance()->getVisibleOrigin();

    SpriteFrameCache* cache = SpriteFrameCache::getInstance();
    cache->addSpriteFramesWithFile("icons.plist", "icons.png");
    
    Sprite* appStoreSprite = Sprite::createWithSpriteFrameName("0.png");
    MenuItemSprite* item = MenuItemSprite::create(appStoreSprite, appStoreSprite);
    item->setCallback([&](Ref* pSender){
        auto scene = TransitionCameraBezel::create(1, HelloWorld::createScene());
        Director::getInstance()->replaceScene(scene);
    });
    
    auto menu = Menu::create(item, NULL);
    menu->setPosition(Point(visibleSize.width/2,visibleSize.height/2));
    this->addChild(menu);
    
    return true;
}
